#!/usr/bin/python
#! encoding: utf-8
import sys
if sys.version_info > (3,0):
	import urllib.request as urllib2
else:
	import urllib2

msg = '''<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://www.huawei.com/bme/aaainterface/cbs/businessmgrmsg" xmlns:com="http://www.huawei.com/bme/aaainterface/common" xmlns:bus1="http://www.huawei.com/bme/aaainterface/cbs/businessmgr">
   <soapenv:Header/>
   <soapenv:Body>
      <bus:QuerySubscriberSessionRequestMsg>
         <RequestHeader>
            <com:CommandId>QuerySubscriberSession</com:CommandId>
            <com:Version>1</com:Version>
            <com:TransactionId></com:TransactionId>
            <com:SequenceId>1</com:SequenceId>
            <com:RequestType>Event</com:RequestType>
            <!--Optional:-->
           
            <!--Optional:-->
            <com:InterFrom>1</com:InterFrom>
            <!--Optional:-->
            <com:InterMode>1</com:InterMode>
            <!--Optional:-->
            <com:InterMedi>23</com:InterMedi>
            <!--Optional:-->
            <com:visitArea>12</com:visitArea>
            <!--Optional:-->
            <com:currentCell>12</com:currentCell>
            <!--Optional:-->
            <com:additionInfo>12</com:additionInfo>
            <!--Optional:-->
            <com:ThirdPartyID>12</com:ThirdPartyID>
            <!--Optional:-->
            <com:Reserve2>1</com:Reserve2>
            <!--Optional:-->
            <com:Reserve3>1</com:Reserve3>
            <!--Optional:-->
            <com:PartnerID>23</com:PartnerID>
            <!--Optional:-->
            <com:OperatorID>12</com:OperatorID>
            <!--Optional:-->
            <com:TradePartnerID>12</com:TradePartnerID>
            <!--Optional:-->
            <com:PartnerOperID>12</com:PartnerOperID>
            <!--Optional:-->
            <com:BelToAreaID>23</com:BelToAreaID>
            <com:SerialNo>12</com:SerialNo>
            <!--Optional:-->
            <com:Remark>1</com:Remark>
            <!--Optional:-->
            <com:Locale>ZH</com:Locale>
         </RequestHeader>
         <QuerySubscriberSessionRequest>
            <!--Optional:-->
            <bus1:SubscriberID>12345678@oss</bus1:SubscriberID>
      
         </QuerySubscriberSessionRequest>
      </bus:QuerySubscriberSessionRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>'''
msg = msg.encode('utf-8')
headers = {
'Content-Type': 'text/xml;charset=UTF-8',
'SOAPAction': "QuerySubscriberSession",  # 修改为请求报文所对应的方法
}
url = 'http://116.6.110.158:7782/services/AAAInterfaceBusinessMgrService.AAAInterfaceBusinessMgrServiceSOAP11port_http/'
u2request = urllib2.Request(url, msg, headers)
u = urllib2.build_opener()
fp = u.open(u2request)
print(fp.read().decode('utf-8'))